import * as tslib_1 from "tslib";
import { observable, action } from "mobx";
import request from "../utils/request";
import * as api from "../api/api";
import { LoadHoc, loading } from "../hoc/loadHoc";
let PublicWelfareStore = class PublicWelfareStore extends LoadHoc {
  constructor() {
    super(...arguments);
    /**
     * 首页banner
     */
    this.banners = {};
    /**
     * 首页公益和活动信息
     */
    this.publicWelfare = {};
    /**
     * 首页公益详情
     */
    this.publicWelfareInfo = {};
    /**
     * 首页活动详情
     */
    this.activitiesInfo = {};
    /**
     * 公益列表
     */
    this.pagedPublicWelfare = {};
    /**
     * 活动列表
     */
    this.pagedActivitiesInfo = {};
  }
  async getBanners(params) {
    const { callback } = params;
    const banners = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareGetBannersAsync({}));
    this.banners = banners;
    callback && callback(banners);
  }
  /**
   * 首页慈善总数据
   */
  async getAllPublicWelfareMoney(params) {
    const { callback } = params;
    const allPublicWelfareMoney = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareGetAllPublicWelfareMoneyAsync({}));
    callback && callback(allPublicWelfareMoney);
  }
  async getPublicWelfare(params) {
    const { callback } = params;
    const publicWelfare = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareGetPublicWelfareAsync({}));
    this.publicWelfare = publicWelfare;
    callback && callback(publicWelfare);
  }
  async getPublicWelfareInfo(params) {
    const { formId, callback } = params;
    const publicWelfareInfo = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareGetPublicWelfareInfoAsync({
      formId
    }));
    this.publicWelfareInfo = publicWelfareInfo;
    callback && callback(publicWelfareInfo);
  }
  async getActivitiesInfo(params) {
    const { formId, callback } = params;
    const activitiesInfo = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareGetActivitiesInfoAsync({
      formId
    }));
    this.activitiesInfo = activitiesInfo;
    callback && callback(activitiesInfo);
  }
  async getPagedPublicWelfare(params) {
    const { pageIndex, pageSize, callback } = params;
    const pagedPublicWelfare = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareGetPagedPublicWelfareAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.pagedPublicWelfare = pagedPublicWelfare;
    callback && callback(pagedPublicWelfare);
  }
  async getPagedActivitiesInfo(params) {
    const { pageIndex, pageSize, callback } = params;
    const pagedActivitiesInfo = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareGetPagedActivitiesInfoAsync({
      formSkipCount: (pageIndex - 1) * pageSize,
      formMaxResultCount: pageSize
    }));
    this.pagedActivitiesInfo = pagedActivitiesInfo;
    callback && callback(pagedActivitiesInfo);
  }
  /**
   * 资助申请保存
   */
  async savePublicWelfare(params) {
    const { form, callback } = params;
    const res = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfareSavePublicWelfareAsync({
      form
    }));
    callback && callback(res);
  }
  /**
   * 资助付款按钮
   */
  async publicWelfareBuy(params) {
    const { form, callback } = params;
    const res = await request(api.ApppublicWelfareApiFetchParamCreactor.apppublicWelfarePublicWelfareBuyAsync({
      form
    }));
    callback && callback(res);
  }
};
export { PublicWelfareStore as default };

tslib_1.__decorate([observable], PublicWelfareStore.prototype, "banners", undefined);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "getBanners", null);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "getAllPublicWelfareMoney", null);
tslib_1.__decorate([observable], PublicWelfareStore.prototype, "publicWelfare", undefined);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "getPublicWelfare", null);
tslib_1.__decorate([observable], PublicWelfareStore.prototype, "publicWelfareInfo", undefined);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "getPublicWelfareInfo", null);
tslib_1.__decorate([observable], PublicWelfareStore.prototype, "activitiesInfo", undefined);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "getActivitiesInfo", null);
tslib_1.__decorate([observable], PublicWelfareStore.prototype, "pagedPublicWelfare", undefined);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "getPagedPublicWelfare", null);
tslib_1.__decorate([observable], PublicWelfareStore.prototype, "pagedActivitiesInfo", undefined);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "getPagedActivitiesInfo", null);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "savePublicWelfare", null);
tslib_1.__decorate([loading, action], PublicWelfareStore.prototype, "publicWelfareBuy", null);